<template>
	<div>
		<h3>输入PM25值：<input type="text" v-model="pm25" /></h3>
		<img :src="pm25img">
	</div>
</template>

<script>
	export default {
		data() {
			return {
				pm25: 201,
			}
		},
		//定义计算属性
		computed: {
			pm25img() {
				let index = 0;
				if (this.pm25 < 100) index = 1;
				else if (this.pm25 < 200) index = 2;
				else if (this.pm25 < 300) index = 3;
				else index = 4;
				return `/img/${index}.png`;
			},
		},
	}
</script>
<style>
</style>